package com.easy.system.design.factory;

/**
 * Created with IntelliJ IDEA.
 * User: sunguangzhu
 * Date: 13-8-9
 * Time: 下午1:05
 * To change this template use File | Settings | File Templates.
 */
public class ConcreteCreator extends Creator {
    @Override
    public <T extends Product> T createProduct(Class<T> clazz) {
        Product product = null;
        try {
            product = (Product) Class.forName(clazz.getName()).newInstance();
        } catch (InstantiationException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        } catch (IllegalAccessException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        } catch (ClassNotFoundException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        }
        return (T) product;  //To change body of implemented methods use File | Settings | File Templates.
    }
}
